// thread_debit.h	0.1	<2012-05-11>	<BARBAY Steve>
#ifndef THREAD_DEBIT_H
#define THREAD_DEBIT_H

#include <QThread>
#include <QMainWindow>
#include <QtNetwork/QHostAddress.h>
#include <winsock2.h>
#include <QVector>
#include <QTimer>
#include "f_bdd.h"

class Thread_Debit : public QThread
{
    Q_OBJECT

public:
    // METHODEs -----------------------------------------------------------------
    // CONSTRUCTEURs et DESTRUCTEURs
    explicit Thread_Debit(QObject *parent = 0);
    virtual ~Thread_Debit();
    void InitTimer(QTimer * timer, int nChoixPeriodicite) ;

private:
    // METHODEs -----------------------------------------------------------------
    bool HoteEstJoignable(QString sAdresseIp) ;
    bool MesurerDebit(QString sAdresseIp) ;
    bool JoindreHote(QString sAdresseIp, int nTaille,int TimeOut, float &Debit) ;
    HOSTENT * RecupererIpSource(ULONG * p_addr);
    HOSTENT * RecupererIpDestination(const char * name, ULONG * p_addr) ;
    USHORT checksum(void * lpData, size_t size) ;
    // ATTRIBUTs ----------------------------------------------------------------
    QVector<InfoDebit>ListeDebitsASurveiller;
    QVector<InfoDebit>nDebitMinimal ;
    QTimer * timer ;
    int nChoixPeriodicite ;

protected:
    // METHODEs -----------------------------------------------------------------
    virtual void run();

signals:
    // METHODEs -----------------------------------------------------------------
    void Signal_AfficherDebit(QString) ;
    void Signal_AfficherHoteInjoignable (QString) ;
    void Signal_AlerterDebitfaible(QString) ;
    void Signal_BarreDeProgression(int) ;
    void Signal_TimerPeriodicite (int) ;

private slots:



};
//------------------------------------------------------------------------------
#endif // THREADDEBIT_H
//------------------------------------------------------------------------------
